<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <link rel="icon" href="${pangeContext.request.cotextPath}/LeisureSeeker/icons/favicon.ico" sizes="16x16"/>
    <title>路线规划</title>

    <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
    <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
    <%--账号申请--%>
    <script type="text/javascript"
            src="https://webapi.amap.com/maps?v=1.4.14&key=e81e352f4489270819adc173133718c0&plugin=AMap.Driving"></script>
    <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
    <style>
        /*为地图容器指定高度、宽度*/
        html, body, #container {
            width: 100%;
            height: 100%;
        }

        #panel {
            position: fixed;
            background-color: white;
            max-height: 90%;
            overflow-y: auto;
            top: 350px;
            right: 10px;
            width: 280px;
        }

        #panel .amap-lib-driving {
            border-radius: 4px;
            overflow: hidden;
        }
    </style>
</head>
<body>
<%--指定容器--%>
<div id="container"></div>
<div id="panel"></div>
<div class="input-card" style='width:28rem;'>111111</div>
<script type="text/javascript">
    // 基本地图加载
    var map = new AMap.Map("container", {
        resizeEnable: true,
        center: [118.03394, 24.48405],// 地图中心点
        zoom: 15 // 地图显示的缩放级别
    });
    //构造路线导航类
    var driving = new AMap.Driving({
        map: map,
        panel: "panel"
    });
    // 根据起终点经纬度规划驾车导航路线
    driving.search(new AMap.LngLat(${begin}), new AMap.LngLat(${end}), {
        waypoints: [new AMap.LngLat(${way}), new AMap.LngLat(${way2}), new AMap.LngLat(${way3})]

    }, function (status, result) {
        // result 即是对应的驾车导航信息，相关数据结构文档请参考  https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingResult
        if (status === 'complete') {
            log.success('绘制驾车路线完成')
        } else {
            log.error('获取驾车数据失败：' + result)
        }
    });
</script>
</body>
</html>